﻿using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using UnityEngine;
using UnityEngine.Playables;
using UnityEngine.Timeline;
/// <summary>
/// 自定义移动轨道 参考 https://blog.csdn.net/qiminixi/article/details/146215237
/// </summary>

[DisplayName("自定义Clip/移动物体")]
[TrackColor(1f,0f,0f)] //规定显示的颜色
[TrackClipType(typeof(MoveClip))] //关联的Clip类型
[TrackBindingType(typeof(Transform))] //绑定的数据类型
public class CustomMoveTrack : TrackAsset
{
    public override Playable CreateTrackMixer(PlayableGraph graph, GameObject go, int inputCount)
    {
        return ScriptPlayable<MoveClipMixerBehaviour>.Create(graph, inputCount);
    }

    public override void GatherProperties(PlayableDirector director, IPropertyCollector driver)
    {
        base.GatherProperties(director, driver);
        var comp = director.GetGenericBinding(this) as GameObject;
        if (comp != null)
        {
            Debug.Log("绑定对象是" + comp);
        }
    }
}
